<template>
  <div>
    <el-card shadow="never" class="mb20" style="overflow: inherit">
      <branch-form @search="handleSearch" ref="branchForm" />
    </el-card>
    <el-card shadow="never">
      <el-tooltip class="item" content="新增党支部科室信息" effect="dark" placement="top">
        <el-button
          size="small"
          class="fr mb20"
          type="primary"
          @click="handleEdit(false, {})"
          icon="el-icon-plus"
        />
      </el-tooltip>
      <branch-table @edit="handleEdit" ref="branchTable" />
    </el-card>
    <branch-modal @refresh="handleSearch" ref="branchModal" />
  </div>
</template>

<script>
import BranchTable from './BranchTable'
import BranchForm from './BranchForm'
import BranchModal from './BranchModal'

export default {
  components: {
    BranchTable,
    BranchForm,
    BranchModal
  },
  methods: {
    handleEdit(bool, row) {
      this.$refs.branchModal.edit(bool, row)
    },
    handleSearch(param = {}) {
      this.$refs.branchTable.handleGetList(param)
    }
  }
}
</script>
